package com.acwing.partition19;

import java.io.*;
import java.util.Arrays;

/**
 * @author `RKC`
 * @date 2022/1/27 18:44
 */
public class AC1826农田缩减 {

    private static final int N = 50010;
    private static int[][] points = new int[N][2];
    private static int n = 0;
    private static int[] p = new int[N], q = new int[N];

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        n = Integer.parseInt(reader.readLine());
        for (int i = 0; i < n; i++) {
            String[] s = reader.readLine().split(" ");
            int x = Integer.parseInt(s[0]), y = Integer.parseInt(s[1]);
            points[i] = new int[]{x, y};
            p[i] = x;
            q[i] = y;
        }
        Arrays.sort(p, 0, n);
        Arrays.sort(q, 0, n);
        int ans = Integer.MAX_VALUE;
        //因为只有边界的点被删除后才会对答案有可能有影响，所以只枚举删除边界的点
        for (int i = 0; i < n; i++) {
            int x = points[i][0], y = points[i][1], w = 0, h = 0;
            if (x == p[0]) w = p[n - 1] - p[1];
            else if (x == p[n - 1]) w = p[n - 2] - p[0];
            else w = p[n - 1] - p[0];

            if (y == q[0]) h = q[n - 1] - q[1];
            else if (y == q[n - 1]) h = q[n - 2] - q[0];
            else h = q[n - 1] - q[0];
            ans = Math.min(ans, w * h);
        }
        writer.write(ans + "\n");
        writer.flush();
    }
}
